home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / demos / VisualAge for Java 2.0 Entry / setup / data1.cab / ide-e / IDE / cache / 1RMKEU1 (.txt) < prev    next >
Encoding:
Java Class File  |  1998-09-16  |  1.8 KB  |  61 lines

  1. package com.sun.java.swing.plaf.basic;
  2.  
  3. import com.sun.java.swing.tree.TreePath;
  4.  
  5. class AbstractTreePath extends TreePath {
  6.    VisibleTreeNode node;
  7.  
  8.    public AbstractTreePath(Object[] newPath, VisibleTreeNode node) {
  9.       super(newPath);
  10.       this.node = node;
  11.    }
  12.  
  13.    public boolean equals(Object o) {
  14.       if (o instanceof AbstractTreePath) {
  15.          AbstractTreePath aTP = (AbstractTreePath)o;
  16.          if (this.node != null && aTP.node != null && aTP.node.treeUI == this.node.treeUI) {
  17.             if (aTP.node == this.node) {
  18.                return true;
  19.             }
  20.  
  21.             if (this.node.isValid && aTP.node.isValid) {
  22.                return false;
  23.             }
  24.          }
  25.       }
  26.  
  27.       return super.equals(o);
  28.    }
  29.  
  30.    public AbstractTreeUI getUI() {
  31.       return this.node.treeUI;
  32.    }
  33.  
  34.    public int hashCode() {
  35.       return super.hashCode();
  36.    }
  37.  
  38.    public String toString() {
  39.       StringBuffer aString = new StringBuffer();
  40.       aString.append("AbstractTreePath: VN ");
  41.       if (this.node != null) {
  42.          aString.append(this.node.hashCode() + " {");
  43.       } else {
  44.          aString.append("NULL {");
  45.       }
  46.  
  47.       if (super.path != null) {
  48.          for(int counter = 0; counter < super.path.length; ++counter) {
  49.             if (counter > 0) {
  50.                aString.append(", ");
  51.             }
  52.  
  53.             aString.append(super.path[counter].toString());
  54.          }
  55.       }
  56.  
  57.       aString.append("}");
  58.       return aString.toString();
  59.    }
  60. }
  61.